Stand Up To Your Code

6-11-2012 Posted by: Qtbon

Here at ACG we are constantly working to perfect our workflow and pipeline.  I think one thing that always trips me up is the fear in the back of my head that a major code rewrite would be too terrifying to pull off.  So instead I would work around it.  I would hack together some nasty little bits of code that would work, but hold the consequence of keeping me up at night, losing sleep over unnecessarily global variables and flimsy yet massive spaghetti code monsters that chase me in my dreams.

XKCD - "Good Code"

XKCD - "Good Code"


The good news is, there’s a simple solution to all of this nonsense.  Do not be afraid of your code.  It’s as simple as that.  Is bad code going to happen?  Yes, there’s no way around it.  In personal conversation and in reading or watching postmortems, I’ve seen too many people mention they made the mistake of not rewriting or revisiting their prototype code.  Don’t fix it if it isn’t broken, right?  Sometimes. Occasionally you need to get things done and then revisit some of your decisions when you find the time.  This can be for personal satisfaction or perhaps it’s the absolute correct thing to do.

 

On one of our more recent projects I started to get held up adding new features towards the end of the cycle because the game states I had been working with were no longer going to cut it.  For awhile I worked with what I had, using some clever workarounds and all was fine.  However I realized I was definitely losing time doing it this way.  In response I took a step back, added some new functionality, did a bit of refactoring, and I was back in business.  Efficient business; rewriting this code was definitely the correct decision.

 

Moral of the story: please please please do not be afraid of your code.  It is your creation after all.  You own it and make sure that it knows who’s boss!  So if you ever think that spending a small portion of time rewriting code will save you oodles of time in the future, I advise you to go for it!  You’ll be a smarter and happier programmer in the end.


Leave a Reply

Your email address will not be published. Required fields are marked *


*